package homework13;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class home001 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ArrayList<Integer> list = new ArrayList<>(Arrays.asList(5,15,20,25,100,50,200,300,500,700,800));
//        home01 h=new home01(list);
//        home01 h2=new home01(list);
        mycallable m1=new mycallable(list);
        mycallable m2=new mycallable(list);
        FutureTask<StringBuilder> f=new FutureTask<>(m1);
        FutureTask<StringBuilder> f1=new FutureTask<>(m2);
        Thread h=new Thread(f);
        Thread h2=new Thread(f1);
        h.setName("抽奖箱1");
        h2.setName("抽奖箱2");
        h.start();
        h2.start();
        StringBuilder stringBuilder1 = f.get();
        StringBuilder stringBuilder = f1.get();
        System.out.println(stringBuilder);
        System.out.println(stringBuilder1);
    }
}
